﻿using System;
using Company.IO.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Company.System.IO.IntegrationTests
{
    public partial class DirectoryTest : TestBase<IDirectory>
    {
        private const string _SMoveMethodName = "Move";

        [TestMethod]
        public void Move_SourceDirNameValidAndDestDirNameValid_MovedDir()
        {
            //Arrange
            string sourceDirName = string.Format("{0}MOVE_SOURCE\\", SLocalPath);
            string destDirName = string.Format("{0}MOVE_DEST\\", SLocalPath);
            global::System.IO.DirectoryInfo dirInfo = global::System.IO.Directory.CreateDirectory(sourceDirName);
            Assert.IsTrue(dirInfo.Exists);

            //Act
            Directory.Move(sourceDirName, destDirName);

            //Assert
            Assert.IsFalse(global::System.IO.Directory.Exists(sourceDirName));
            Assert.IsTrue(global::System.IO.Directory.Exists(destDirName));
        }

        [TestMethod]
        public void Move_SourceDirNameNull_ArgumentNullException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, string>();
            object[] parameterValues = GetValueArray(SStringNull, SStringNull);
            //Act
            ExpectException<ArgumentNullException>(_SMoveMethodName, parameterTypes, parameterValues);
            //Assert
        }

        [TestMethod]
        public void Move_SourceDirNameEmpty_ArgumentException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, string>();
            object[] parameterValues = GetValueArray(SStringNull, SStringNull);
            //Act
            ExpectException<ArgumentException>(_SMoveMethodName, parameterTypes, parameterValues);
            //Assert
        }

        [TestMethod]
        public void Move_SourceDirNameValidAndDestDirNameNull_ArgumentNullException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, string>();
            object[] parameterValues = GetValueArray(SLocalPath, SStringNull);
            //Act
            ExpectException<ArgumentNullException>(_SMoveMethodName, parameterTypes, parameterValues);
            //Assert
        }

        [TestMethod]
        public void Move_SourceDirNameValidAndDestDirNameEmpty_ArgumentException()
        {
            //Arrange
            Type[] parameterTypes = GetTypeArray<string, string>();
            object[] parameterValues = GetValueArray(SLocalPath, SStringNull);
            //Act
            ExpectException<ArgumentException>(_SMoveMethodName, parameterTypes, parameterValues);
            //Assert
        }
    }
}